Skip to content

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Dec 10, 2025

This PR introduces fully typed API clients, with models generated directly from OpenAPI specifications.

Description

Issues

Testing

  • Add "easy win" additional integration tests, but avoid complex workflows (e.g. Actor creation, execution, and waiting for completion - these things are still being tested only from the SDK).

@vdusek vdusek self-assigned this Dec 10, 2025
@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 10, 2025
@github-actions github-actions bot added this to the 129th sprint - Tooling team milestone Dec 10, 2025
@vdusek vdusek changed the title refactor!: Add fully typed clients refactor!: Introduce fully typed clients [WIP] Dec 10, 2025
@vdusek vdusek force-pushed the typed-clients branch 2 times, most recently from e470329 to 64a173b Compare December 17, 2025 12:18
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 90.60686% with 178 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.59%. Comparing base (4a763f6) to head (b63c972).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/apify_client/_resource_clients/run.py 64.61% 23 Missing ⚠️
src/apify_client/_resource_clients/task.py 32.14% 19 Missing ⚠️
src/apify_client/_resource_clients/actor.py 60.46% 17 Missing ⚠️
src/apify_client/_resource_clients/build.py 42.85% 12 Missing ⚠️
src/apify_client/_resource_clients/schedule.py 36.84% 12 Missing ⚠️
src/apify_client/_resource_clients/user.py 69.23% 12 Missing ⚠️
src/apify_client/_resource_clients/webhook.py 36.84% 12 Missing ⚠️
...rc/apify_client/_resource_clients/actor_env_var.py 33.33% 8 Missing ⚠️
...rc/apify_client/_resource_clients/actor_version.py 50.00% 8 Missing ⚠️
src/apify_client/_resource_clients/dataset.py 75.00% 8 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #554      +/-   ##
==========================================
+ Coverage   76.01%   84.59%   +8.58%     
==========================================
  Files          42       41       -1     
  Lines        2468     3844    +1376     
==========================================
+ Hits         1876     3252    +1376     
  Misses        592      592              
Flag Coverage Δ
integration 83.11% <90.23%> (+14.15%) ⬆️
unit 73.85% <84.27%> (+9.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

super().__init__(*args, resource_path=resource_path, **kwargs)

def list(self) -> ListPage[dict]:
def list(self) -> ListPage[EnvVar]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ListPage is not fully based on API. API returns only total + items , so the rest is made up: count, offset, limit, desc

This is already in code, but since this aims at improving the API....
Fixing it would complicate the types quite a bit though

Comment on lines 148 to 153
class PricingModel3(Enum):
FREE = 'FREE'


class FreeActorPricingInfo(CommonActorPricingInfo):
pricing_model: Annotated[Literal['FREE'], Field(alias='pricingModel')]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this literal or Enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird, however, the tool has a configurable option to use either enums or literals, so I switched to literals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce fully typed client Write integration tests

3 participants